package com.service;

import com.dao.CardDAO;
import com.dao.MemberDAO;
import com.model.Card;
import com.model.Member;

public class CardController extends Controller{
	
	Card card = null;
	
	
	public CardController(String command, int type) {
		super();
		String [] commands = command.split(" ");
		MemberDAO  memberDAO = new MemberDAO();
		Member member = memberDAO.selectMember(commands[2]);
		if (member != null) {
			
			if (type == 1) {
				card = new Card(false, "none", member.getMemberID(),member.getName());
			} else if (type == 2){
				card = new Card(true, commands[4], member.getMemberID(),member.getName());
			}
			
			
		}
		CardDAO cardDAO = new CardDAO();
		cardDAO.createCard(card, type);
		//card = new Card(commands[2], commands[3], commands[4]);
		//MemberDAO memberDAO = new MemberDAO();
		//member = memberDAO.creatMember(member);boolean tp, String msg, int mbID, String Nm
		
	}
	
	public Card queryResult() {
		return card;
	}
}
